package pl.qsoft.db.storedProc.complex;

import java.sql.Connection;

/**
 * Main class with definition of contract of complex types buliders.
 * Defines abstract method (base method of complex type builder) 
 * and some required data.    
 * 
 * @author Maciej Peruga
 */
public abstract class ComplexObjectBuilder {
	
	/**
	 * Connection can be used in process of registration of vendor specific types.
	 */
	private Connection connection;

	public final void setConnection(Connection connection) {
		this.connection = connection;
	}

	public final Connection getConnection() {
		return connection;
	}

	/**
	 * Method with implementation of complex type builder logic.  
	 * 
	 * @param objectIn - object that represents instance data required in building process
	 * @return - outgonig object, representation of complex type.
	 */
	public abstract Object buildObject(Object objectIn);
	
	
	
	/**
	 * Method used for logging object
	 * @param objectIn	- object that represents instance data
	 * @return - string value of object
	 */
	public String toString(Object objectIn) {
		return objectIn.toString();
	}

}
